package com.tianji.learning.service;


import com.baomidou.mybatisplus.extension.service.IService;
import com.tianji.api.dto.trade.OrderBasicDTO;
import com.tianji.common.domain.dto.PageDTO;
import com.tianji.common.domain.query.PageQuery;
import com.tianji.learning.domain.dto.LearningPlanDTO;
import com.tianji.learning.domain.po.LearningLesson;
import com.tianji.learning.domain.vo.LearningLessonVO;
import com.tianji.learning.domain.vo.LearningPlanPageVO;

import java.util.List;

/**
 * <p>
 * 学生课表 服务类
 * </p>
 *
 * @author 虎哥
 * @since 2024-03-11
 */
public interface ILearningLessonService extends IService<LearningLesson> {
    /**
     * 批量添加课程到用户
     * @param userId
     * @param courseIds
     */
    void addUserLessons(Long userId, List<Long> courseIds);

    /**
     * 我的课表分页查询排序字段
     * @param query
     * @return
     */
    PageDTO<LearningLessonVO> queryMyLessons(PageQuery query);

    /**
     * 查询最近学习的课程
     * @return
     */
    LearningLessonVO queryMyCurrentLesson();

    /**
     * 删除课表
     */
    void deleteLesson(Long courseId);


    /**
     * 检查课程是否有效
     * @param courseId
     * @return
     */
    Long isLessonValid(Long courseId);


    /**
     * 查看用户指定课程状态
     * @param courseId
     * @return
     */
    LearningLesson getLessonStatus(Long courseId);

    /**
     * 统计课程的学习人数
     * @param courseId
     * @return
     */
    Integer countLearingLessonByCourse(Long courseId);

    /**
     * 创建学习计划
     * @param learningPlanDTO
     */
    void createPlan(LearningPlanDTO learningPlanDTO);

    /**
     * 定时任务 没隔15s查询课表课程是否过期 如果过期则修改课表状态
     */
    void springTaskExpireTime();

    /**
     * 查询我本周的学习计划
     * @param pageQuery
     * @return
     */
    LearningPlanPageVO queryMyPlans(PageQuery pageQuery);

    /**
     * 监听订单退款成功，删除用户相关课程表
     */
    void deleteLessonByMq(OrderBasicDTO dto);

    LearningLesson queryByUserAndCourseId(Long userId, Long courseId);
}
